package ch.ethz.inf.shop.util;

import javax.servlet.http.HttpSession;

import ch.ethz.inf.shop.model.RegisteredUser;

public class UserManagement {

	private final static String SESSION_USER = "LOGGED_IN_USER";

	public static final RegisteredUser getCurrentlyLoggedInUser(final HttpSession session) {
		final Object obj = session.getAttribute(SESSION_USER);
		if (obj == null) {
			return null;
		} else {
			return (RegisteredUser) obj;
		}
	}

	public static final void setCurrentlyLoggedInUser(final HttpSession session, final RegisteredUser user) {
		session.setAttribute(SESSION_USER, user);
	}

}
